<?php

namespace App\Models\User;

use App\Models\BaseModel;

/**
 * 部门管理的模型层
 *
 * Class Department
 * @package App\Models\User
 */
class Department extends BaseModel
{
    /**
     * The table associated with the model.
     *
     * @var string
     */
    protected $table = 'department';

    /**
     * Indicates if the model should be timestamped.
     * @var bool
     */
    public $timestamps = false;

    /**
     * 获得此部门的角色。
     */
    public function enableAuths()
    {
        return $this->belongsToMany('\App\Models\User\Role', 'department_role')->wherePivot('status', 1);
    }
}
